<?php

/**
 * This is the model class for table "sptpd".
 *
 * The followings are the available columns in table 'sptpd':
 * @property integer $kode_sptpd
 * @property integer $no_reg
 * @property string $no_form
 * @property string $thn_sptpd
 * @property string $nik_wp
 * @property string $kode_sk
 * @property double $ls_tnh
 * @property double $njop_tan
 * @property double $jml_tnh
 * @property double $ls_bng
 * @property double $njop_bng
 * @property double $jml_bng
 * @property double $tot_njop1
 * @property double $ls_tnh2
 * @property double $njop_tan2
 * @property double $jml_tnh2
 * @property double $ls_bng2
 * @property double $njop_bng2
 * @property double $jml_bng2
 * @property double $tot_njop2
 * @property double $harga_psr
 * @property double $npop_off
 * @property double $npop_self
 * @property double $npoptkp_off
 * @property double $npoptkp_self
 * @property double $nilai_pjk1
 * @property double $nilai_pjk2
 * @property double $nilai_tng1
 * @property double $nilai_tng2
 * @property double $prs_1
 * @property double $prs_2
 * @property integer $sanksi
 * @property double $prs_bunga
 * @property double $selisih
 * @property double $pajak_bphtb
 * @property double $npopkp
 * @property string $tgl_setor
 * @property string $no_dok
 * @property string $no_pbb
 * @property string $no_sk
 * @property string $tgl_prs
 * @property string $sts_prs
 * @property double $denda
 * @property double $bunga
 * @property integer $bulan
 * @property double $tot_pajak
 * @property double $nilai_konf
 * @property string $nihil
 *
 * The followings are the available model relations:
 * @property Setoran[] $setorans
 * @property DokTerima $noReg
 */
class Sptpd extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sptpd';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('no_reg, sanksi, bulan', 'numerical', 'integerOnly'=>true),
			array('ls_tnh, njop_tan, jml_tnh, ls_bng, njop_bng, jml_bng, tot_njop1, ls_tnh2, njop_tan2, jml_tnh2, ls_bng2, njop_bng2, jml_bng2, tot_njop2, harga_psr, npop_off, npop_self, npoptkp_off, npoptkp_self, nilai_pjk1, nilai_pjk2, nilai_tng1, nilai_tng2, prs_1, prs_2, prs_bunga, selisih, pajak_bphtb, npopkp, denda, bunga, tot_pajak, nilai_konf', 'numerical'),
			array('no_form', 'length', 'max'=>9),
			array('thn_sptpd', 'length', 'max'=>4),
			array('nik_wp, kode_sk', 'length', 'max'=>25),
			array('no_dok', 'length', 'max'=>15),
			array('no_pbb', 'length', 'max'=>18),
			array('no_sk', 'length', 'max'=>8),
			array('sts_prs, nihil', 'length', 'max'=>1),
			array('tgl_setor, tgl_prs', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('kode_sptpd, no_reg, no_form, thn_sptpd, nik_wp, kode_sk, ls_tnh, njop_tan, jml_tnh, ls_bng, njop_bng, jml_bng, tot_njop1, ls_tnh2, njop_tan2, jml_tnh2, ls_bng2, njop_bng2, jml_bng2, tot_njop2, harga_psr, npop_off, npop_self, npoptkp_off, npoptkp_self, nilai_pjk1, nilai_pjk2, nilai_tng1, nilai_tng2, prs_1, prs_2, sanksi, prs_bunga, selisih, pajak_bphtb, npopkp, tgl_setor, no_dok, no_pbb, no_sk, tgl_prs, sts_prs, denda, bunga, bulan, tot_pajak, nilai_konf, nihil', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'setorans' => array(self::HAS_MANY, 'Setoran', 'kode_sptpd'),
			'noReg' => array(self::BELONGS_TO, 'DokTerima', 'no_reg'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kode_sptpd' => 'Kode Sptpd',
			'no_reg' => 'No Reg',
			'no_form' => 'No Form',
			'thn_sptpd' => 'Thn Sptpd',
			'nik_wp' => 'Nik Wp',
			'kode_sk' => 'Kode Sk',
			'ls_tnh' => 'Ls Tnh',
			'njop_tan' => 'Njop Tan',
			'jml_tnh' => 'Jml Tnh',
			'ls_bng' => 'Ls Bng',
			'njop_bng' => 'Njop Bng',
			'jml_bng' => 'Jml Bng',
			'tot_njop1' => 'Tot Njop1',
			'ls_tnh2' => 'Ls Tnh2',
			'njop_tan2' => 'Njop Tan2',
			'jml_tnh2' => 'Jml Tnh2',
			'ls_bng2' => 'Ls Bng2',
			'njop_bng2' => 'Njop Bng2',
			'jml_bng2' => 'Jml Bng2',
			'tot_njop2' => 'Tot Njop2',
			'harga_psr' => 'Harga Psr',
			'npop_off' => 'Npop Off',
			'npop_self' => 'Npop Self',
			'npoptkp_off' => 'Npoptkp Off',
			'npoptkp_self' => 'Npoptkp Self',
			'nilai_pjk1' => 'Nilai Pjk1',
			'nilai_pjk2' => 'Nilai Pjk2',
			'nilai_tng1' => 'Nilai Tng1',
			'nilai_tng2' => 'Nilai Tng2',
			'prs_1' => 'Prs 1',
			'prs_2' => 'Prs 2',
			'sanksi' => 'Sanksi',
			'prs_bunga' => 'Prs Bunga',
			'selisih' => 'Selisih',
			'pajak_bphtb' => 'Pajak Bphtb',
			'npopkp' => 'Npopkp',
			'tgl_setor' => 'Tgl Setor',
			'no_dok' => 'No Dok',
			'no_pbb' => 'No Pbb',
			'no_sk' => 'No Sk',
			'tgl_prs' => 'Tgl Prs',
			'sts_prs' => 'Sts Prs',
			'denda' => 'Denda',
			'bunga' => 'Bunga',
			'bulan' => 'Bulan',
			'tot_pajak' => 'Tot Pajak',
			'nilai_konf' => 'Nilai Konf',
			'nihil' => 'Nihil',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kode_sptpd',$this->kode_sptpd);
		$criteria->compare('no_reg',$this->no_reg);
		$criteria->compare('no_form',$this->no_form,true);
		$criteria->compare('thn_sptpd',$this->thn_sptpd,true);
		$criteria->compare('nik_wp',$this->nik_wp,true);
		$criteria->compare('kode_sk',$this->kode_sk,true);
		$criteria->compare('ls_tnh',$this->ls_tnh);
		$criteria->compare('njop_tan',$this->njop_tan);
		$criteria->compare('jml_tnh',$this->jml_tnh);
		$criteria->compare('ls_bng',$this->ls_bng);
		$criteria->compare('njop_bng',$this->njop_bng);
		$criteria->compare('jml_bng',$this->jml_bng);
		$criteria->compare('tot_njop1',$this->tot_njop1);
		$criteria->compare('ls_tnh2',$this->ls_tnh2);
		$criteria->compare('njop_tan2',$this->njop_tan2);
		$criteria->compare('jml_tnh2',$this->jml_tnh2);
		$criteria->compare('ls_bng2',$this->ls_bng2);
		$criteria->compare('njop_bng2',$this->njop_bng2);
		$criteria->compare('jml_bng2',$this->jml_bng2);
		$criteria->compare('tot_njop2',$this->tot_njop2);
		$criteria->compare('harga_psr',$this->harga_psr);
		$criteria->compare('npop_off',$this->npop_off);
		$criteria->compare('npop_self',$this->npop_self);
		$criteria->compare('npoptkp_off',$this->npoptkp_off);
		$criteria->compare('npoptkp_self',$this->npoptkp_self);
		$criteria->compare('nilai_pjk1',$this->nilai_pjk1);
		$criteria->compare('nilai_pjk2',$this->nilai_pjk2);
		$criteria->compare('nilai_tng1',$this->nilai_tng1);
		$criteria->compare('nilai_tng2',$this->nilai_tng2);
		$criteria->compare('prs_1',$this->prs_1);
		$criteria->compare('prs_2',$this->prs_2);
		$criteria->compare('sanksi',$this->sanksi);
		$criteria->compare('prs_bunga',$this->prs_bunga);
		$criteria->compare('selisih',$this->selisih);
		$criteria->compare('pajak_bphtb',$this->pajak_bphtb);
		$criteria->compare('npopkp',$this->npopkp);
		$criteria->compare('tgl_setor',$this->tgl_setor,true);
		$criteria->compare('no_dok',$this->no_dok,true);
		$criteria->compare('no_pbb',$this->no_pbb,true);
		$criteria->compare('no_sk',$this->no_sk,true);
		$criteria->compare('tgl_prs',$this->tgl_prs,true);
		$criteria->compare('sts_prs',$this->sts_prs,true);
		$criteria->compare('denda',$this->denda);
		$criteria->compare('bunga',$this->bunga);
		$criteria->compare('bulan',$this->bulan);
		$criteria->compare('tot_pajak',$this->tot_pajak);
		$criteria->compare('nilai_konf',$this->nilai_konf);
		$criteria->compare('nihil',$this->nihil,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return Sptpd the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
